﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorSeaFaces.h
 * @brief  VAOne读写FACES适配器
 * 
 * @author lixiaolong (lixiaolong@diso.cn)
 * @date   2024-10-30
 *********************************************************************/
#ifndef VAONEXMLADAPTORSEAFACES_H
#define VAONEXMLADAPTORSEAFACES_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITKAcousticsModel/FITKAbstractSEASubSysWithNodes.h"

namespace Acoustics
{
    class FITKSEAFaceManager;
    class FITKAbstractSEAFace;
}

namespace IO
{
    /**
     * @brief   VAOne读写FACE适配器
     * @author  lixiaolong (lixiaolong@diso.cn)
     * @date    2024-11-7
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorSeaFaces : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorSeaFaces);
    public:

        /**
         * @brief   构造函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        explicit VAOneXMLAdaptorSeaFaces()= default;

        /**
         * @brief   析构函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        ~VAOneXMLAdaptorSeaFaces() = default;

        /**
         * @brief   适配器读数据
         * @return  true 读写成功 false 读取失败
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        virtual bool adaptR() override;

        /**
         * @brief   适配器写数据
         * @return  true 写入成功 false 写入失败
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
         virtual bool adaptW() override;

    protected:

        /**
         * @brief getNodeName 获取xml节点名字
         * @return  xml节点名字 类型无效时需子类自己实现adaptR和adaptW 有效时根据实际数据重新实现读写接口
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual QString getNodeName() = 0;

        /**
         * @brief getNodeType 获取节点类型
         * @return  节点类型 类型无效时需子类自己实现adaptR和adaptW 有效时根据实际数据重新实现读写接口
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual Acoustics::FITKAbstractSEASubSys::SEASubSysType getNodeType() = 0;

        /**
         * @brief createDataObjNode 创建数据节点
         * @return 数据节点实例
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual Acoustics::FITKAbstractSEAFace *createDataObjNode() = 0;

        /**
         * @brief readNode  读取单个face数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readFaceId(rapidxml::xml_node<char>* node, Acoustics::FITKAbstractSEAFace *data);

        /**
         * @brief readNode  读取单个face节点数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @return 节点列表
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual QList<Acoustics::FITKAbstractSEASubSysWithNodes::SubSysNode> readNode(rapidxml::xml_node<char>* node);

        /**
         * @brief readCell  读取单个face单元数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readTriangle(rapidxml::xml_node<char>* node, Acoustics::FITKAbstractSEAFace *data);

        /**
         * @brief readCell  读取单个face声学数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readNCT(rapidxml::xml_node<char>* node, Acoustics::FITKAbstractSEAFace *data);

        /**
         * @brief readCell  读取单个face数据
         * @param node[i]      xml节点
         * @param data[o]      节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual void readCell(rapidxml::xml_node<char> *node, Acoustics::FITKAbstractSEAFace *data);

        /**
         * @brief readCell  写入单个face id数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeFaceId(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node);

        /**
         * @brief readCell  写入单个face节点数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual void writeNode(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node);

        /**
         * @brief readCell  写入单个face 单元数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeTriangle(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node);

        /**
         * @brief readCell  写入单个face 声学数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeNCT(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node);

        /**
         * @brief writeCell  写入单个face数据
         * @param data[i]      节点数据
         * @param node[o]      xml节点
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        virtual void writeCell(Acoustics::FITKAbstractSEAFace *data, rapidxml::xml_node<char> *node);
    };
}

#endif // VAONEXMLADAPTORSEAFACES_H
